package cn.example.elasticsearch_demo.entiry;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;

import java.io.Serializable;
import java.util.Date;


@Data
@Document(indexName = "esuser")
public class ESUser implements Serializable {


    private @Id
    Long id;

    @Field(analyzer = "ik_smart", type = FieldType.Text)
    private String name;

    @MultiField(mainField = @Field(analyzer = "ik_smart", type = FieldType.Text), otherFields = @InnerField(suffix = "inner", type = FieldType.Text))
    private Integer age;

    @Field(analyzer = "ik_smart", type = FieldType.Text)
    private String sex;

    @MultiField(mainField = @Field(analyzer = "ik_smart", type = FieldType.Text), otherFields = @InnerField(suffix = "inner", type = FieldType.Keyword))
    private String address;

    @Field(type = FieldType.Date,format = DateFormat.year_month_day)
    private Date caretDate;

    @Field(type = FieldType.Date,format = DateFormat.year_month_day)
    private Date updateDate;

    @MultiField(mainField = @Field(analyzer = "ik_smart", type = FieldType.Text), otherFields = @InnerField(suffix = "inner", type = FieldType.Keyword))
    private String Description;
}
